function set_img_src(){
    var reads= new FileReader();
    f=document.getElementById('sel').files[0];
    reads.readAsDataURL(f);
    reads.onload=function (e) {
        document.getElementById('preview').src = this.result;
    };
}

function send_img(){
    var files = document.getElementById("sel").files;
    console.log(files);
    var form_data = new FormData();
    form_data.append("upload_img", files[0]);
    $.ajax({
        url: "/upload",
        type: "POST",
        data: form_data,
        contentType: false,
        processData: false,
        success: function(arg){
            console.log('video URL:');
            console.log(arg);
            var display_img=document.getElementById('result');
            display_img.setAttribute('src',arg);
        },
        error: function(){
            alert('bad upload');
        }
    });
}